import {getActionSimple} from "@/util/api";
import LocalStorageConstant from "@/constant/LocalStorageConstant";
import {UniStorage} from "@/util/uniUtils";

export default class UserApi{
    static url = {
        login:'/api/user/login',
        logout:'/api/user/logout',
        changePassword:'/sys/user/changePassword',
        getUserInfo:'/api/user/getUserInfo',
        tokenRefresh:'api/user/tokenRefresh',
    }


    /**
     * 获取用户信息
     */
    static async getUserInfo(){
        try {
            return await getActionSimple(UserApi.url.getUserInfo)
        } catch (e) {
            console.log("获取用户信息失败")
        }
    }

    /**
     * 从缓存中获取用户信息
     * @returns {*}
     */
    static getUserInfoByCache(){
        return UniStorage.get(LocalStorageConstant.USER_INFO)
    }
}
